package net.maku.module.train.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import net.maku.framework.common.utils.PageResult;
import net.maku.framework.common.utils.Result;
import net.maku.module.train.convert.TrainStaffConvert;
import net.maku.module.train.entity.TrainStaffEntity;
import net.maku.module.train.service.TrainStaffService;
import net.maku.module.train.vo.TrainStaffVO;
import net.maku.newbase.NewBaseController;
import net.maku.newbase.NewQuery;
import net.maku.newbase.PageParam;

import org.springframework.web.bind.annotation.*;

/**
* 业务_培训_员工
*
* @author    
*/
@RestController
@RequestMapping("nb/train_staff")
@Tag(name="业务_培训_员工")
@AllArgsConstructor
public class TrainStaffController extends NewBaseController<TrainStaffService, TrainStaffEntity> {

    @GetMapping("page")
    @Operation(summary = "分页")
    public Result<PageResult<TrainStaffVO>> page(PageParam page, NewQuery query){
        LambdaQueryWrapper<TrainStaffEntity> select = new LambdaQueryWrapper<>();

        IPage<TrainStaffEntity> iPage = entityService.page(page.b(), select);
        return Result.ok(new PageResult<>(TrainStaffConvert.INSTANCE.convertList(iPage.getRecords()), iPage.getTotal()));
    }

}